package com.wchat.service;

import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
public class AccessLogAspect {

        @Before("@annotation(org.springframework.web.bind.annotation.PostMapping) || @annotation(org.springframework.web.bind.annotation.RequestMapping)")
        public void doBeforeInServiceLayer(JoinPoint joinPoint) {
            Object[] args = joinPoint.getArgs();
            log.info("执行方法为：{}， 参数列表为：{}", joinPoint.toShortString(), Lists.newArrayList(args));
        }

}
